package com.example.smartcity.Mappers;

import com.example.smartcity.Entity.Comment;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface VideoCommentMapper {
    @Select("select id as videoid from video where title like CONCAT('%', #{videoname}, '%')")
    int getVideoidByVideoName(String videoname);
    @Insert("insert into videocomment(videoid,userid,comment,createtime) values(#{videoid},#{userid},#{comment},#{createtime})")
    void pressComment(int videoid,int userid,String comment,String createtime);
    @Select("SELECT * FROM videocomment WHERE videoid=#{videoid} ORDER BY commentid DESC;")
    List<Comment> getCommentByVideoid(int videoid);
}
